<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
         .rect{display: flex;width: 400px;height: 200px;background-color: #e45757;}
        .blue{width: 100px;height: 100px;background:blue;}
    </style>
    <script src="../js/vue.js"></script>
</head>
<body>
    <div id="app" >
        <!--.stop修饰符阻止单击事件继续传播，即阻止事件冒泡行为-->
        <!-- 连续触发事件，叫做冒泡事件 -->
        <div @click="divClick">
            <button @click.stop="btnClick">button</button>
        </div>
        
  <!-- .prevent修饰符：对某些DOM元素进行某种操作时，会出现一些默认行为，.revent -->
        <form action="baidu">
            <input type="submit" @click.prevent="submitClick">
        </form>


        <!-- .self修饰符只监听触发该DOM元素的本身事件 -->
        <div class="rect" v-on:click.self="alertRed">
            <div class="blue" v-on:click="alertBlue">蓝色</div>
        </div>

        <!-- .once -->
        <button></button>
        <!-- 监听某个键帽事件 -->
        <input type="text" @keyup.enter="keyUp">

    </div>

    <script>
        let app = new Vue({
            el:"#app",
            data:{
                msg:'hello world'
            },
            methods:{
                divClick(){
                    console.log("div");
                },
                btnClick(){
                    console.log("btn");
                },
                submitClick(){
                    console.log("submit")
                },
                alertRed(){
                    console.log("red");
                },alertBlue(){
                    console.log("blue");
                }

            }
        })
    </script>
</body>
</html>